package lec15dfs;

import java.util.Scanner;

public class C {
    static int n = 5;
    static int[] a = new int[n];
    static int[] b = new int[n];
    static boolean[] book = new boolean[n];
    static int best = Integer.MAX_VALUE;

    static void dfs(int k) {
        if (k == n) {

            int cur = (b[0] * 10 + b[1]) * (b[2] * 100 + b[3] * 10 + b[4]);
            if (b[0] != 0 && b[2] != 0 && cur < best)
                best = cur;
            return;// 1
        }
        for (int i = 0; i < n; i++) {
            if (book[i])
                continue;
            b[k] = a[i];
            book[i] = true;
            dfs(k + 1);
            book[i] = false;
        }
    }

    public static void main(String[] args) {
        for (int i = 0; i < n; i++) {
            a[i] = cin.nextInt();
        }
        dfs(0);
        System.out.println(best);
    }

    static Scanner cin = new Scanner(System.in);
}